Restricting records for lookup fields
For certain configurations of relationships, you can restrict the available records for a lookup field based on other related records using the Main Lookup and Link Lookup properties of a lookup field. These properties are only available when an object has relationships to at least two objects that are also related to each other. For example, suppose your application has Country, State, and Company objects with the following relationships:
- The relationship between Country and State is one-to-many.
- The relationship between Country and Company is one-to-many.
- The relationship between State and Company is one-to-many.

In this example, the Company object's lookup field State has the following properties:

The Main Lookup property specifies that the company's related country limits the choices for the lookup field.
The Link Lookup property specifies that the State lookup field will be restricted to the country's related states.
The following example illustrates how the Company's State lookup field is restricted.
The application contains two countries:

The country Canada has four states:

The country United States has five states:

After setting a company's country, its State lookup field is filtered to show only that country's states:

You can also restrict the records for a lookup field using the client-side API rbf_setLookupFilter().